home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 051-075 / scopedisk52 / ts / ts.mod < prev    next >
Text File  |  1995-03-18  |  3KB  |  124 lines

  1. MODULE TimeSaverTickler;
  2.  
  3. (** ------------------------------------------------------------------
  4.  
  5.            This is the MODULA-2 Program Source Code
  6.  
  7.            TimeSaver for the Commodore Amiga - ClockTickler Module 
  8.  
  9.            This Program is placed in the Public Domain By its Author
  10.  
  11.            Written June 2nd, 1987 by E.J. Lippert II, for C Ltd.
  12.  
  13.     ------------------------------------------------------------------ **)
  14.  
  15.  
  16. (*  ====================================================================
  17.      VERSION FOR COMMODORE AMIGA
  18.  
  19.      Original Author : E.J. Lippert II for C Ltd.
  20.  
  21.      Version         : 1.00 - 02-Jun-87 02:33
  22. =====================================================================  *)
  23.  
  24.  
  25. FROM SYSTEM IMPORT ADDRESS;
  26. FROM InOut IMPORT Read, WriteString, WriteLn;
  27. FROM DOSCodeLoader IMPORT Execute;
  28.  
  29.  
  30. VAR
  31.  
  32.         ch [12578305] : CHAR;  (* this is the address of the keyboard Port *)
  33.         i : CARDINAL;
  34.         D : ARRAY [0..80] OF CHAR;
  35.         DUMMY : BOOLEAN;
  36.  
  37. BEGIN
  38.  
  39. D[0] := CHR(0);
  40. i:= 0;
  41.  
  42. (* ==============================================================
  43.  
  44.         First Send a Value of 64 to the keyboard port and hold
  45.         this value for approx 10 ms. 
  46.  
  47.         The Value 64 sets the Bit at the port that causes the
  48.         Keyboard Data Line to go HIGH.
  49.  
  50.         10 ms. is worst case time required for a properly
  51.         operating TimeSaver to sense the HIGH line condition.
  52.  
  53. ============================================================== *)
  54.  
  55. ch := CHR(64);
  56.  
  57. LOOP
  58. IF i > 8191 THEN EXIT; END;
  59. INC(i);
  60. END;
  61.  
  62. ch := CHR(0);
  63.  
  64. (* ==============================================================
  65.  
  66.         A properly operating TimeSaver will now respond by
  67.         sending either the normally formatted Amiga DATE
  68.         Command (ie: DATE DD-MON-YY HH:MM) if it is active.
  69.  
  70.         If however the TimeSaver has been turned off, or the 
  71.         TimeSaver's Screen Echo has been disabled, a properly 
  72.         operating TimeSaver will respond with the date only.
  73.         (ie: DD-MON-YY HH:MM)
  74.  
  75. ============================================================== *)
  76.  
  77.  
  78.  
  79. Read(D[0]);    (* Read the first character sent by the TimeSaver *)
  80.  
  81. IF D[0] = "D" THEN   (* If it is a "D" then assume TimeSaver is
  82.                         active and collect the DATE Command info *)
  83.         i := 1;
  84.         REPEAT
  85.                 Read(D[i]);
  86.                 INC(i);
  87.         UNTIL D[i-1] = CHR(10);
  88.         D[i-1] := CHR(0);
  89.  
  90. ELSE                 (* Otherwise assume TimeSaver is not active so
  91.                         Collect the RAW DATE and format the command *)
  92.         D[5] := D[0];
  93.         D[0] := "D";
  94.         D[1] := "A";
  95.         D[2] := "T";
  96.         D[3] := "E";
  97.         D[4] := " ";
  98.         i := 6;
  99.         REPEAT
  100.                 Read(D[i]);
  101.                 INC(i);
  102.         UNTIL D[i-1] = CHR(10);
  103.         D[i-1] := CHR(0);
  104.  
  105. END;
  106.  
  107. DUMMY := (Execute(D, 0, 0));            (* Execute the DATE Command 
  108.                                            and print notices.       *)
  109. WriteLn;
  110.  
  111. D := "Correct Time Now Set  -  TimeSaver   by C Ltd.";
  112. D[35] := CHR(169);
  113. WriteString(D);
  114.  
  115. WriteLn;
  116.  
  117. D := "                         Tickler by E.J. Lippert";
  118. WriteString(D);
  119.  
  120. WriteLn;
  121.  
  122.  
  123. END TimeSaverTickler.
  124.